<div id="pageInfo" data-title="找回密码"></div>
<section class="find_pw">
	<ul class="tab">
		<li class="on">短信找回</li>
		<li>邮箱找回</li>
	</ul>
	<div class="con input_li">
		<ul>
			<form action='{url:/simple/find_password_mobile}' method='post' id="mobileWay">
				<li>
					<input class='input_text' placeholder="请输入您的用户名" initmsg="" type="text" name='username' pattern="^[\w\u0391-\uFFE5]{2,20}$" alt="请输入正确的用户名" />
				</li>
				<li>
					<input class='input_text' placeholder="请输入您的手机号" initmsg="" type="text" name="mobile" pattern="^[1][34578][0-9]{9}$"  alt="号码格式不正确" />
				</li>
				<li>
					<input class='input_text input_captcha' placeholder="手机验证码" initmsg="" type="text" name="mobile_code"/>
					<span class="sendMessage" onclick="sendMessage()">发送手机验证码</span>
				</li>
				<li>
					<input type="submit" class="input_submit" value="找回密码">
				</li>
			</form>
		</ul>
		<ul class="none">
			<form action='{url:/simple/find_password_email}' method='post' id="mailWay">
				<li>
					<input class='input_text' placeholder="请输入您的用户名" initmsg="" type="text" name='username' pattern="^[\w\u0391-\uFFE5]{2,20}$" alt="请输入正确的用户名" />
				</li>
				<li>
					<input class='input_text' placeholder="请输入您的邮箱" initmsg="" type="text" name='email' pattern="email" alt="邮箱格式不正确" />
				</li>
				<li>
					<input type="submit" class="input_submit" value="找回密码">
				</li>
			</form>
		</ul>
	</div>
</section>
<script>
$(function(){
	// 给底部导航加上当前样式
	$(".nav_user").addClass('on');
	$(".footer_login").hide();
	// 选项卡切换
	var tab = $(".tab"),
		con = $(".con").children('ul');
	tab.on('click', 'li', function(){
		var t = $(this),i = t.index();
		t.addClass('on').siblings('li').removeClass('on');
		con.eq(i).removeClass('none').siblings('ul').addClass('none');
	});
})

  //发送短信码
function sendMessage(){
	var username = $('#mobileWay [name="username"]').val();
	var mobile   = $('#mobileWay [name="mobile"]').val();
	$.get("{url:/simple/send_message_mobile}",{"username":username,"mobile":mobile},function(content){
		if(content == 'success'){
			alert('发送成功，请查看您的手机');
		}
		else{
			alert(content);
			return;
		}
	});
}
</script>